package com.letv.business.flow.PlayFlowState;

import android.text.TextUtils;

import com.ledim.app.LeDimApplication;
import com.ledim.datastatistics.LeDimAnalysisUtils;
import com.letv.android.client.LetvSDK;
import com.letv.business.flow.PlayFlowEvents.PlayIdleEvent;
import com.letv.business.flow.PlayFlowEvents.StartPlayEvent;
import com.letv.core.bean.IVideo;
import com.letv.core.utils.LetvSDKUtils;
import com.letv.core.utils.LogInfo;
import com.letv.datastatistics.util.DataConstant;
import com.letv.tracker2.agnes.VideoPlay;
import com.letv.tracker2.enums.PlayStart;

import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.net.HttpURLConnection;
import java.net.URL;

/**
 * Created by jipengfei on 2016/11/2.
 */
public class PlayStartPlayState extends BasePlayState{

    @Override
    protected void injectDependencies() {
        LeDimApplication.getComponentInstance().inject(this);
    }

    @Override
    public void onStateApplied(){
        super.onStateApplied();

        LogInfo.log("sguotao", "进入StartPlayState");

        mPlayFlow = getProvider().providPlayFlow();

        mPlayFlow.startPlayNet();

        //播放机状态结束,播放状态重置
        fireEvent(PlayFlowEvents.Play_Finish);

    }

    @Override
    public void onStateLeft() {
        super.onStateLeft();

    }

    @Subscribe
    public void onPlayOnCalllEvent(StartPlayEvent startPlayEvent) {

        fireEvent(PlayFlowEvents.Play_OnCall);
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onPlayIdleEvent(PlayIdleEvent playIdleEvent) {

        fireEvent(PlayFlowEvents.Play_Idle);
    }
}
